﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using Baimasoft.FrameWork.Base;
using Baimasoft.Manage.SqlServerDAL;
using HsTec.Mobile.Green.SqlServerDAL;

public partial class DocumentManage_Down_Document2 : System.Web.UI.Page
{
    DataFolder MyFolder = new DataFolder();
    DataFile MyDataFile = new DataFile();
    BaimasoftFile MyFile = new BaimasoftFile();
    LogManage MyLog = new LogManage();

    public string sFileCol = "function   downFiles() { ";   //var sFeatures = \"dialogHeight:0px;dialogWidth:0px;resizeable:no;help:no;status:no\";


    public string m_Root = ConfigurationManager.AppSettings["DocumentMange"];
    public string sDownPath = ConfigurationManager.AppSettings["DownFilePath"];
    public string sSwitchPath = ConfigurationManager.AppSettings["DocumentSwitchPath"];
    public string sEncryptFile = ConfigurationManager.AppSettings["EncryptFile"];


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            try
            {
                string sChoiceIDCol = Request.QueryString["ChoiceIDCol"].ToString().Trim(); //选择文件ID集合
                string[] aCholceID = sChoiceIDCol.Split('|');
                int iChoiceID = aCholceID.Length;
                for (int i = 0; i < iChoiceID; i++)
                {
                    string sFileName = "";
                    string sDownFilePath = "";    //原文件所在路径
                    string sChoicePath = "";
                    if (aCholceID[i].Length > 0)
                    {
                        DataTable MyDT = MyDataFile.GetDataFileInfo(Convert.ToInt32(aCholceID[i]));  //取各文件的相关信息；
                        foreach (DataRow dr in MyDT.Rows)
                        {
                            sChoicePath = dr["path"].ToString().Trim();
                            sChoicePath = sChoicePath.Replace("\\", "\\\\");
                            sFileName = dr["AliasName"].ToString().Trim();
                            sDownFilePath = sChoicePath + "\\" + sFileName;
                            string sUrlPath = sDownPath + "!" + sFileName;

                            sFileCol = sFileCol + "window.open('ReadDocument.aspx?DocName=" + sFileName + "&DocPath=" + sChoicePath + "');";
                        }

                    }
                }
                sFileCol += "} window.close(); ";
            }
            catch
            {
            }
        }
    }
}
